<?php
class Reset extends Controller {
	function Reset() {
		parent::Controller();
		$this->load->helper("url");
		$this->data["base"] = $this->config->item('base_url');
        $this->load->model('Resetmd');
		$this->load->model('Mail');
        session_start();
	}
	var $data;
	function index() {
		
		$this->load->view('layout/head', $this->data);
		$this->load->view('layout/body', $this->data);
		$this->load->view('layout/reset', $this->data);
		$this->load->view('layout/footer', $this->data);
	}
	function Cekreset() {
		$username = $this->input->post('username');
		$email = $this->input->post('email');
		
		$xd = $this->Resetmd->cekUsername($username,$email)->row();
		
		if((isset($xd->name) == $username) and (isset($xd->email) == $email) and ($username !="") and ($email !="") ) {
			$name= $username;
			$pass = "l0g1n";
			$b =array('pass' =>md5($pass));
			
			$this->Resetmd->upPassword($name,$b);
			/* set mail
			$this->Mail->config_mail();
			$this->Mail->resetPass();
			*/
			$this->session->set_flashdata('message', 'update password sucses cek your mail ... !');
			redirect('reset');
			
		} else {
			$this->session->set_flashdata('message', 'Cek username and Mail ... !');
			redirect('reset');
		}
		
	}
	
}
?>